/**   
* @Title: 圆形面积周长计算实现
* @Package:com.sample.shapecalc.impl
* @Description:圆形面积周长计算实现 
* @author lihuizhuo
* @date  
* @version V1.0   
*/
package com.testdemo.web.shapecalc.impl;

import com.testdemo.web.question.IShapeCalcQusition;

/** 
* @ClassName: CircleQuestionImpl 
* @Description: 圆形面积周长计算实现
* @author:lihuizhuo
* @date:2014-08-01
*/  
public class CircleQuestionImpl
   extends ShapeQuestionImpl
   implements IShapeCalcQusition {
   
       /**
        * CircleR:半径，构造时随机产生，1-11.
        *   
        * @since Ver 1.1   
        */   
   int Circler;
	  
	    /**   
	     * 创建一个新的实例 CircleQuestionImpl.   
	     *
	     */
	    
	public CircleQuestionImpl()
	{
		Circler = Math.abs((int)(Math.random() * 10 + 1));
		CalcArea();
		CalcPerimeter();
	}
	
	public CircleQuestionImpl(final int r){
		Circler = r;
		CalcArea();
		CalcPerimeter(); 
	}
	
	@Override
	public final void CalcArea(){
		Area = Math.PI * Circler * Circler;
	}
	public final void CalcPerimeter(){
		Perimeter = 2 * Math.PI * Circler;
	}
	
	@Override
	public final String getQusitionString() {
		// TODO Auto-generated method stub
		String temp;
		temp = "题目：一个半径为R = " + Integer.toString(Circler) + ", 请计算该园的面积和周长。";
		return temp;
	} 
}
